home *** CD-ROM | disk | FTP | other *** search
/ Turnbull China Bikeride / Turnbull China Bikeride - Disc 2.iso / STUTTGART / NEWSOFT / AUGUST / WORKDISC / !Forthmacs / spread / spread_doc < prev    next >
Text File  |  1995-10-19  |  3KB  |  99 lines

  1.  
  2.             Forth Spreadsheet
  3.  
  4.  
  5. This is the "Craig Lindley" Forth Spreadsheet which was published in
  6. Forth Dimensions, Vol. 7 Nos. 1 and 2.  That article contains a discussion
  7. of the implementation.  The port to Forthmacs required a few source code
  8. changes, particularly in order to make it work on a 32-bit Forth
  9. implementation.  I also increased the number of rows from 26 to 100,
  10. eliminated some redundant screen redisplays in the GO_TO command, rewrote
  11. a lot of the cursor movement code, and added control key bindings so that
  12. the EMACS cursor movement keys can be used as well as the arrow keys.
  13.  
  14. To get started:
  15.  
  16.     fload spread.fth
  17.     spreadsheet
  18.  
  19. Spreadsheet commands:
  20.  
  21.             Cursor Movement
  22.  
  23. up         ^P, up_arrow        Up one row
  24. down         ^N, down_arrow        Down one row
  25. left         ^B, left_arrow        Left one column
  26. right         ^F, right_arrow    Right one column
  27. left_page     ^Y, F1            Left 4 columns
  28. right_page     ^U, F2            Right 4 columns
  29. up_page          ^T, F3            Up 15 rows
  30. down_page     ^V, F4            Down 15 rows
  31. first_col     ^A, F5            Go to column A
  32. last_col     ^E, F6            Go to column Z
  33. top_row             F7            Go to row 0.
  34. bottom_row         F8            Go to row 99
  35. go_to         g            Prompts for new row and column
  36.  
  37.                Other
  38.  
  39. input_cell_data     d            Put number in cell
  40. input_equ     e            Put equation in cell
  41. input_row_names     r            Put labels on rows
  42. input_col_names     c            Put labels on columns
  43. format         f            Select integer or dollar format
  44. replicate_col     a            Copy data to other columns
  45. mode         m            Select auto or manual recalculation
  46. new         n            Erase spreadsheet
  47. calc_order     o            Select row or column calculation order
  48. perform_calc     p, ^L            Recalculate
  49. quit_calc     q, ^Z            Exit
  50.  
  51.  
  52.             Equations
  53.  
  54. Equations are entered in infix notation, for example:
  55.  
  56.     5 b + ( 10 c * 11 f )
  57.  
  58. The spaces are required.  This equation multiplies cell "10 C" by cell
  59. "11 F", and adds cell "5 B" to the result.  In this example, the parentheses
  60. are redundant, since * has a higher precedence than +.
  61.  
  62. Operators:
  63.  
  64.     *  /        Highest precedence
  65.     +  -        Normal precedence
  66.     mod        Lowest precedence
  67.  
  68. Operators with the same precedence associate from left to right.
  69.  
  70.  
  71.         What is Wrong with this Spreadsheet
  72.  
  73. 1) The recalculation algorithm is naive.  Instead of calculating rows first,
  74.    then columns, (or vice versa), a spreadsheet should keep a dependency
  75.    graph and recalculate only those paths in the graph which depend on
  76.    changed data.  This would eliminate redundant recalculation.
  77.  
  78. 2) There should be a way to specify a range of values in an equation, for
  79.    example:  sum all the entries between cell 3 A and cell 10 A.
  80.  
  81. 3) Reverse-Polish notation for equations is more flexible, and would allow
  82.    any Forth operator to appear in an equation.
  83.  
  84. 4) Should use the mouse, GEM windows, etc.
  85.  
  86. 5) There should be a print command.
  87.  
  88. 6) There should be some way to store the spreadsheet state in a file and
  89.    restore it later.
  90.  
  91. 7) There should be some way to insert/delete whole rows/columns.
  92.  
  93. 8) The key bindings should be set by dictionary entries, in the same way
  94.    that Forthmacs binds editing keys.
  95.  
  96. 9) The current cell should be marked with inverse video.
  97.  
  98. 10) It should be possible to enter numbers without using the "D" command.
  99.